﻿#include "formlog.h"
#include "ui_formlog.h"
#include "logger.h"


FormLog::FormLog(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::FormLog)
{
    ui->setupUi(this);
    connect(&Logger::Instance(),SIGNAL(OnLogging(QString)),this,SLOT(log(QString)));
}

FormLog::~FormLog()
{
    delete ui;
}

void FormLog::log(QString log)
{
    ui->txtLog->appendPlainText(log);
    if(ui->txtLog->document()->lineCount()>500)
    {
        ui->txtLog->document()->clear();
    }
}
